﻿using Architecture.Domain.Service;
using Architeture.Domain.DTO;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Role;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Role
{
    public class RoleInfoGetAllCommandHandler : IRequestHandler<RoleInfoGetAllCommand, List<RoleInfoDTO>>
    {
        protected readonly IRoleService roleService;

        public RoleInfoGetAllCommandHandler(IRoleService roleService)
        {
            this.roleService = roleService;
        }

        public async Task<List<RoleInfoDTO>> Handle(RoleInfoGetAllCommand request, CancellationToken cancellationToken)
        {
            return await roleService.GetRoleInfo();
        }
    }
}
